/**
    Copyright (c) 2010-2011 yakiimo02
    Distributed under the New BSD License.
    See included license.txt or http://www.yakiimo3d.com/NewBSDLicense.txt
**/

#pragma once

#include "MandelbrotBase.h"

class DataBufferDX11;
struct cudaGraphicsResource;

/**    
    @brief  Cuda implemention of the Mandelbrot fractal.
    @date   2011/02/27
*/
class MandelbrotCuda : public MandelbrotBase
{
public:
    MandelbrotCuda();
    ~MandelbrotCuda();

    HRESULT OnCreateDevice( ID3D11Device* pd3dDevice );
    HRESULT OnResizedSwapChain( ID3D11Device* pd3dDevice, DataBufferDX11* pDataBuffer );
    void    OnFrameRender( ID3D11Device* pd3dDevice, ID3D11DeviceContext* pd3dImmediateContext,
                                  double fTime, float fElapsedTime, void* pUserContext );
    void    OnDestroyDevice();

protected:
    HRESULT CompileShaders( ID3D11Device* pd3dDevice );

protected:
    int                         m_nWidth;               // mandelbrot texture width
    int                         m_nHeight;              // mandelbrot texture height
    cudaGraphicsResource*       m_pCudaResourceTarget;  // cuda output resource target
};